package org.zjt.threadlocal;

import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Description:
 *
 * @author juntao.zhang
 * Date: 2018-06-20 下午1:11
 * @see
 */
@Slf4j
public class Task implements Runnable {

    private String msg ;

    private ThreadLocal[] threadLocals;

    public Task(String msg,ThreadLocal ... threadLocals) {
        this.msg = msg;
        this.threadLocals = threadLocals;
    }

    @Override
    public void run() {
        List<Object> collect = Arrays.stream(threadLocals).map(ThreadLocal::get).collect(Collectors.toList());
        log.info("collect:{} \t msg:{}",collect,msg);
    }
}
